/**
 * Created by Administrator on 2017/7/6.
 */
$(function () {
//    轮播图
//
    var count;
    var span_count;
    var mySwiper = new Swiper ('.swiper-container', {
        loop: true,
        autoplay:8000,
        // 如果需要分页器
        pagination: '.swiper-pagination',
        // 如果需要前进后退按钮
        nextButton: '.swiper-button-next',
        prevButton: '.swiper-button-prev',
        paginationClickable :true,
        onSlideChangeEnd: function(swiper){
             count = swiper.activeIndex;
            $(".swiper-pagination span").each(function (index,elem) {
               if($(elem).hasClass("swiper-pagination-bullet-active")){
                   span_count = index;
               }
               if(span_count==1){
                   $(".head-left a").css("color","black");
                   $(".head-right li a").css("color","black");
                   $(".head-right li a").eq(0).css("color","#0093e9");
                   $(".head-right li a").hover(function () {
                       $(this).css("color","#0093e9");
                   },function () {
                       if(!$(this).parent().hasClass('active')){
                           $(this).css("color","black");
                       }

                   });
               }else {
                   $(".head-left a").css("color","white");
                   $(".head-right li a").css("color","white");
                   $(".head-right li a").hover(function () {
                       $(this).css("color","#0093e9");
                   },function () {
                       if(!$(this).parent().hasClass('active')){
                           $(this).css("color","white");
                       }
                   });
                   $(".head-right li a").eq(0).css("color","#0093e9");
               }
            });
             if(count>1){
                 $(".swiper-wrapper>div").find("img").removeClass("banner_text");
                 $(".swiper-wrapper>div").eq(count).find("img").eq(1).addClass("banner_text");
             }else if(count == 1){
                 $(".swiper-wrapper>div").find("img").removeClass("banner_text");
                 $(".swiper-wrapper>div").eq(1).find("img").eq(1).addClass("banner_text");
             }else{
                 $(".swiper-wrapper>div").find("img").removeClass("banner_text");
                 $(".swiper-wrapper>div").eq(0).find("img").eq(1).addClass("banner_text");
             }

        }

});

    var status = true;
    $(".logo_right").click(function () {
        status = false;
        $(".intro-content").animate({left:"-82.5%"},300);
        hover();
    });
    $(".logo_left").click(function () {
        status = true;
        $(".intro-content").animate({left:"0%"},300);
        hover();
    });
    hover();
    function hover() {
        if(status){
            $('.logo_left').off('mouseenter').unbind('mouseleave');
            $(".logo_right").hover(function () {
                $(this).find("img").attr("src","images/index/arr_hover.png");
            },function () {
                $(this).find("img").attr("src","images/index/arr_logo_right.png");
            });
            $('.logo_left img').attr('src','images/index/forbid_left.png');
            $('.logo_right img').attr('src','images/index/arr_logo_right.png');
        }else {
            $('.logo_right').off('mouseenter').unbind('mouseleave');
            $(".logo_left").hover(function () {
                $(this).find("img").attr("src","images/index/arr_hover_left.png");
            },function () {
                $(this).find("img").attr("src","images/index/arr_logo_left.png");
            });
            $('.logo_right img').attr('src','images/index/forbid_right.png');
            $('.logo_left img').attr('src','images/index/arr_logo_left.png');
        }

    }


});